feat(access-control): per-group chat-deploy auth modes + polish#5818
Conversation
- Add a per-permission-group 'Auth modes chat deployments may use' control, mirroring the existing public-file-share auth-mode control, so admins can disable specific chat auth modes (Public, Password, ...) - Enforce it server-side on chat create/update via validateChatDeployAuth (ChatDeployAuthNotAllowedError -> 403), and filter the chat deploy UI's Access-control options to the allowed set (keeping the saved mode visible) - Remove the dead 'Template' deploy option (hideDeployTemplate had no consumer) - Shrink access-control block permission icons (size-[9px]) so they no longer touch their tile borders; normalize the tiles to size-[16px]
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Config & admin UI: New Enforcement: New Deploy modal: Access control options are filtered via Minor UI polish: smaller block icons in permission group tiles ( Reviewed by Cursor Bugbot for commit 97b8db6. Configure here. |
Greptile SummaryThis PR adds per-group controls for chat deployment authentication modes. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (4): Last reviewed commit: "fix(access-control): never leave a new c..." | Re-trigger Greptile |
…auth - Enforce validateChatDeployAuth on the copilot executeDeployChat path (it called performChatDeploy directly, bypassing the HTTP-route gate) - Enforce on update only when the auth mode actually changes, so a grandfathered saved mode can be re-saved (e.g. title-only edits) - Chat deploy UI now grandfathers only the saved mode, not the unsaved 'public' default; snap a new chat off a disallowed default to the first allowed mode so it can't submit a value the server rejects
|
@cursor review |
…nv is off Treat savedAuthType === 'sso' as SSO-enabled when building auth options so an existing SSO chat isn't dropped and silently downgraded by the snap effect. Mirrors the file-share modal.
|
@cursor review |
Guard the chat-deploy and file-share auth-mode multiselects so the last allowed mode can't be removed while the feature is enabled — an empty allow-list would silently block every deployment/share. Disabling the feature entirely stays the job of the Hide Chat toggle / Public Sharing checkbox.
… modes Surface SSO in the chat deploy options whenever the permission group explicitly allows it (not only when the env flag is on or the chat is saved as SSO), so a group whose only allowed mode is SSO can't produce an empty option set that strands a new chat on a disallowed default. Also drop a redundant trailing comment in the copilot deploy handler.
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 97b8db6. Configure here.
Summary
POST /api/chat) and update (PATCH /api/chat/manage/[id]) via a newvalidateChatDeployAuth(throwsChatDeployAuthNotAllowedError→ 403), reusing the samegetUserPermissionConfigresolver the file-share gate uses.hideDeployTemplatehad no consumer anywhere).size-[9px]) so they no longer touch their tile borders, and normalize the tiles to thesize-[16px]shorthand.Implementation notes
allowedChatDeployAuthTypes(ShareAuthType[] | null,null= all allowed) added topermissionGroupConfigSchema,PermissionGroupConfig,DEFAULT_PERMISSION_GROUP_CONFIG,parsePermissionGroupConfig, and thepermissionGroupFullConfigSchemacontract. No DB migration — config is a JSONB blob and the parser defaults the field for existing rows.validatePublicFileSharing; no-ops for non-enterprise / access-control-disabled orgs.Type of Change
Testing
validateChatDeployAuth(allow-list hit/miss,null= all, non-enterprise no-op) and 403 enforcement tests on both chat create and update routes. Full suite: 87 passing.tsc,biome, andcheck:api-validationall clean.Checklist